﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _06_BinaryToHexadecimalQuick
{
    class Program
    {
        static void Main(string[] args)
        {
            string binaryNumber = Console.ReadLine();
            StringBuilder result = new StringBuilder();
            StringBuilder a = new StringBuilder(binaryNumber);
            if (binaryNumber.Length % 4 != 0)
            {
                int difference = binaryNumber.Length % 4;
                int numberOfMissingZeros = 4 - difference;
                for (int index = 0; index < numberOfMissingZeros; index++)
                {
                    a.Insert(0, '0');
                }

            }
            binaryNumber = a.ToString();
            for (int index = 0; index <= binaryNumber.Length - 1 ; index += 4)
            {
                #region a
                switch (binaryNumber.Substring(index, 4))
                {
                    case "0000":
                        result.Append("0");
                        break;
                    case "0001":
                        result.Append("1");
                        break;
                    case "0010":
                        result.Append("2");
                        break;
                    case "0011":
                        result.Append("3");
                        break;
                    case "0100":
                        result.Append("4");
                        break;
                    case "0101":
                        result.Append("5");
                        break;
                    case "0110":
                        result.Append("6");
                        break;
                    case "0111":
                        result.Append("7");
                        break;
                    case "1000":
                        result.Append("8");
                        break;
                    case "1001":
                        result.Append("9");
                        break;
                    case "1010":
                        result.Append("A");
                        break;
                    case "1011":
                        result.Append("B");
                        break;
                    case "1100":
                        result.Append("C");
                        break;
                    case "1101":
                        result.Append("D");
                        break;
                    case "1110":
                        result.Append("E");
                        break;
                    case "1111":
                        result.Append("F");
                        break;
                    default:
                        result.Append("");
                        break;
                }
                #endregion
            }
            Console.WriteLine(result);
        }
    }
}
